package org.nyl.java.model.dao.impl;

import java.io.Serializable;
import java.util.List;

import org.hibernate.cfg.NotYetImplementedException;
import org.nyl.java.model.dao.BaseDAO;
import org.nyl.java.model.dao.IConcursoDao;
import org.nyl.java.model.entity.Concurso;
import org.springframework.stereotype.Repository;
import org.springframework.transaction.annotation.Transactional;

import com.googlecode.genericdao.search.Search;

@Repository
public class ConcursoDaoImpl extends BaseDAO<Concurso, Serializable> implements IConcursoDao{
		
	@Override
	@Transactional
	public List<Concurso> getConcursosFinalizados() {
		throw new NotYetImplementedException("No implementado");
	}

	@Override
	@Transactional
	public Concurso nuevoConcurso(Concurso c) {
		return save(c);
	}

	@Override
	@Transactional
	public List<Concurso> getAllConcursos() {
		return findAll();
	}

	@Override
	@Transactional
	public int getConcursosCount() {
		return count(new Search(Concurso.class));
	}

	@Override
	public Concurso getConcursoById(Serializable id) {
		return find(id);
	}
	
}
